package org.NooLab.itexx.app.gui.definition;

import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.Image;

import java.awt.Insets;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;

import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import javax.swing.AbstractButton;
import javax.swing.ActionMap;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JToolBar;
import javax.swing.JTree;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.WindowConstants;

import org.NooLab.itexx.ITexxWindow;
import org.NooLab.itexx.ITexxWindowCommons;
import org.NooLab.itexx.ITexxWindowIntf;
import org.NooLab.itexx.ResultsDisplayAgent;
import org.NooLab.itexx.app.config.ITexxAppPropertiesIntf;
import org.NooLab.itexx.app.controller.ItexxModelController;

import org.NooLab.itexx.app.gui.TransparentTextPane;
import org.NooLab.itexx.app.gui.handlers.MainStatusBar;
import org.NooLab.itexx.app.gui.handlers.ResultPanelPopupMenu;
import org.NooLab.itexx.app.gui.handlers.WindowAppearance2;
import org.NooLab.itexx.app.gui.handlers.WindowAppearanceIntf;
import org.NooLab.itexx.app.gui.handlers.keys.ItexxGuiKeyListener;
import org.NooLab.utilities.files.DFutils;
import org.NooLab.utilities.gui.FileDrop;
import org.NooLab.utilities.logging.PrintLog;
import org.NooLab.utilities.resources.ResourceLoader;
import org.jdesktop.application.Application;

import com.sun.jna.examples.WindowUtils;




public class ITexxWindowGui2 implements ITexxWindowGuiIntf{

	private static final boolean _DEBUG = true;
	
	protected static int clics = 0;
	ITexxWindow iTexxWindow;
	
	// ITexxWindow texxWindowApp ;
	ITexxWindowIntf iTexxWindowApp;
	
	private JFrame frame;
	
	
	float transparencyOfVisible = 0.8f;
	
	
	JPanel parentBasePanel ;
	JPanel jPanel1;
	JPanel jPanel2;
	TransparentTextPane txtPane;
	//cJPanel jPanelImgPng; // we will load a PNG image of which some parts are transparent
	private boolean windowIsTransparent;
	private ItexxGuiKeyListener appKeyListener;
	
	PrintLog out = new PrintLog(2,false) ;
	@SuppressWarnings("unused")
	private Font f11;
	private Font f13;
	private Font f14;
	private Font f16;

	
	float _dred = ITexxWindowGuiIntf._DRED;
	float _dgreen = ITexxWindowGuiIntf._DGREEN;
	float _dblue = ITexxWindowGuiIntf._DBLUE;
	float _dd1 = 0.98f;
	
	Map<JComponent,_BaseColor> mappedColors = new HashMap<JComponent,_BaseColor>();
	
	
	ITexxWindowGui2 windowGui;
	private ItexxModelController itexxModel;
	WindowAppearanceIntf windowAppearance,resultsDisplayAgent ;
	// Keyhandlers keyHandlers ;
	GuiEvents guiEvents;
	
	private JPanel contentPanel;
	private JTabbedPane TabbedPaneMain;
	
	private JPanel jPanelMainStatusBar;
	
	private JPanel jPanelFoundTab;
	private JPanel PanelFound;
	private JPanel jPanelFoundScrollerHost;
	private JPanel jPanelScrollWrapFoundStack;
	private JScrollPane ScrollPaneReturnedResults;
	private JTextArea TextTolerated;
	private ITexxWindowCommons appCommons;
	private JTextArea TextExclude;
	private JTextArea TextMandatory;
	private JTextArea TextNormal;
	private JToolBar mainToolBar;
    private JSeparator jSeparator;
    private JButton newButton;
    private JButton saveButton;
    private JButton openButton;

	private boolean isSimpleWindow;
	private JPanel jPanelPGraphics;
	private JPanel GraphicPanel;
	private JPanel[] jPanelGPborder = new JPanel[4];
	private JPanel jPanelGraphicsHost;
	private Canvas canvasProcessingGraphics;
	private JPanel jPanelFocusHost;
	private JPanel PanelFocus, jPanelFocusContentMain;
	private JTextArea jFocusNormalTextAreaFileDrop;
	private JTabbedPane jTabbedPaneFocus;
	private JPanel PanelFocusNormal;
	private JPanel jPanelFocusNormalBottom;
	private JPanel jPanelFocusNormalFileDropArea;
	private JPanel jPanelFocusNormalLabelContainer;
	private JLabel jLabelFocusNormal;
	private JPanel PanelFocusMandatory;
	private JPanel jPanelFocusNormalBottomN;
	private JPanel PanelFocusExcludes;
	private JPanel PanelFocusTolerated;
	private JLabel LabelFocusExplanation;
	private JLabel LabelFocusExplanation2;
	private JPanel jPanelHistoryTree;
	private JPanel PanelRequest;
	private JTree jTreeRequestsHistory;
	private JPanel PanelFocusExplanation;
	private JPanel jPanelLeft;
	private JPanel PanelReqRight;
	private JPanel PanelReqBottom;
	private JPanel jPanelWebMeta;
	private JLabel LabelFocusExplanation3;
	private JPanel jPanelReqTop;
	private JTextField TextFieldDedicatedSearch;
	private JPanel PanelFileAreaSeparator1;
	private JButton ButtonRequestOpenFile;
	private JPanel PanelMetaSearchBrowser;
	private JPanel jPanelFocusFileDropOrnamentWest;
	private JLabel jLabelFocusMandatory;
	private JLabel jLabelFocusExcludes;
	private JLabel jLabelFocusExcludes2;
	private JLabel jLabelFocusTolerated;
	private JLabel jLabelFocusTolerated2;
	private JPanel jPanelFocusExplanation;
	private JPanel jPanelFocusContentOrnamentW;
	private JPanel jPanelFocusContentButtonHost;
	private JPanel jPanelFocusContentButtonArea1;
	private JPanel jPanelMetaReqTextFieldHost;
	private JPanel jPanelMetaReqOrnamentE;
	private JPanel jPanelMetaReqFiledropHost;
	private JPanel jPanelMetaReqOrnamentI;
	private JButton jButtonFocusContent1;
	private JPanel jPanelReqHistoryTop;
	private ITexxWindowGuiFormSettings guiFormSettings;
	private JPanel toolBarPanel;
	private JPanel jPanelToolbarSep1;
	private JButton jButtonSingleWindow;
	@SuppressWarnings("unused")
	private JPanel PanelFoundTabButtonHost;
	
	
	private ITexxAppPropertiesIntf appProperties;
	private int xpos;
	private int lastClickedPhysicalResultsPanel;
	private MainStatusBar mainStatusBar;

	private ResultPanelPopupMenu resultPanelPopupMenu;
	
	
	// ========================================================================
	public ITexxWindowGui2( ITexxWindowIntf iTexxWindow ) {
		// 
		frame = iTexxWindow.getMainFrame();
		
		iTexxWindowApp = iTexxWindow;
		windowGui = this;
		f11 = new Font("Tahoma", 11, 11);
		f13 = new Font("Tahoma", 13, 13);
		f14 = new Font("Tahoma", 14, 14);
		f16 = new Font("Tahoma", 16, 16);

		
		
	}
	// ========================================================================
	
	
	public Point screenSize(){
		 Toolkit kit = Toolkit.getDefaultToolkit();
		 
		 Dimension screenSize = kit.getScreenSize();
		 int screenHeight = screenSize.height;
		 int screenWidth = screenSize.width;
		 Point p = new Point();
		 p.x = screenWidth;
		 p.y = screenHeight;
		 
		 return p;
	}
	
	@SuppressWarnings("unused")
	public void createITexxWindowGui() {
		// 
		
		appCommons = iTexxWindowApp.getAppCommons();

		appProperties = appCommons.getAppProperties() ;
		
		guiEvents = new GuiEvents(this);
		
		itexxModel = new ItexxModelController (iTexxWindowApp) ;
		
		boolean decoratedWindow=true; // command line: show window handles on next start
		
		Dimension d,basicdim ;

		out.setPrefix("[iTexx-Gui]");
		out.print(2, "starting (1) ...");

		configureResultPanelPopupMenu();
		
		resultsDisplayAgent = new ResultsDisplayAgent((ITexxWindowGuiIntf)this);  
		windowAppearance = new WindowAppearance2((ITexxWindowGuiIntf)this);
		
		iTexxWindowApp.getAppCommons().setWindowAppearanceEngine( windowAppearance );
		iTexxWindowApp.getAppCommons().setResultsDisplayAgent( resultsDisplayAgent );
		// windowAppearance = iTexxWindowApp.getAppCommons().setWindowAppearanceEngine();

		int basicWidth = 350;
		int basicHeight = 650;

		
		d = new Dimension(basicWidth, basicHeight);
		basicdim = new Dimension(basicWidth, basicHeight);
		
		
		
		frame.setSize(basicWidth+20, basicHeight);
		
		
		d = new Dimension(basicWidth/2, basicHeight/3);
		frame.setMinimumSize(d);
		frame.setSize(basicdim);
		frame.setPreferredSize(basicdim);

		frame.setResizable(true);
		frame.setUndecorated(false); // this comes from gui

		
		Point scs = screenSize() ;
		// get screen width
		xpos=scs.x-10-d.width;
		frame.setLocation(scs.x+100,120);
		
		setlookandfeel();
		
		frame.setExtendedState( Frame.NORMAL); // for fullscreen -> Frame.MAXIMIZED_BOTH
		
		if (appProperties==null){
			appProperties = this.appCommons.getAppProperties() ;
		}
		frame.setAlwaysOnTop( appProperties.getAlwaysOnTop());
		
		 
		frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
	    
	    System.setProperty("sun.java2d.noddraw", "true");
	    WindowUtils.setWindowTransparent(frame, false); // this can be set during runtime !!
	    WindowUtils.setWindowAlpha(frame, transparencyOfVisible); // <<<<<<<<<<<<<<<<<<<<<
	    windowIsTransparent = true;
	    
	    
	 // this panel will contain all further components and it will be invisible will be pale red
	    parentBasePanel = new JPanel(); //  
	    parentBasePanel.setOpaque( windowIsTransparent );
	    parentBasePanel.setVisible(true);
	    
	    setMappedColor( parentBasePanel, new float[]{_dred,_dgreen,_dblue }) ;
	    if (_DEBUG)parentBasePanel.setToolTipText("parentBasePanel = top panel") ;
	    
	   // FlowLayout parentBasePanelLayout = new FlowLayout();
	    BorderLayout parentBasePanelBorderLayout = new BorderLayout();
	    parentBasePanel.setLayout(parentBasePanelBorderLayout);
		
		d = new Dimension(basicWidth/2, basicHeight);
		parentBasePanel.setMinimumSize(d);

		int maxWidth = (int) (screenSize().x*0.6);
		parentBasePanel.setMaximumSize(new java.awt.Dimension(maxWidth, screenSize().y-30));
		parentBasePanel.setPreferredSize(basicdim);
		parentBasePanel.setSize(basicdim);
		
		parentBasePanel.setFocusable(true);
		parentBasePanel.setEnabled(true);


		frame.add(parentBasePanel);
		
			{ // A panel that is holding the main tabbedPane and a statusbar Panel (yet to do...)
				contentPanel = new JPanel();
                BorderLayout contentPanelLayout = new BorderLayout();
                contentPanel.setLayout(contentPanelLayout);
                
                if (_DEBUG)contentPanel.setToolTipText("contentPanel");
                contentPanel.setName("contentPanel");
                contentPanel.setMinimumSize(new java.awt.Dimension(50, 350));
                
                int w = parentBasePanel.getWidth()-4;
                contentPanel.setPreferredSize(new java.awt.Dimension(w, basicHeight-20));

                contentPanel.setOpaque( true) ; // false = invisible showBasePanel );
                contentPanel.setVisible(true);
                setMappedColor(contentPanel, new float[]{_dred,_dgreen,_dblue,0.6f} );
                // this automatically sets the background
                
    			// probably important for MAC OSX? 
                // contentPanel.putClientProperty("Window.alpha", 0.4f);
    			
    			
                parentBasePanel.add(contentPanel, BorderLayout.CENTER);
                
                {
                    toolBarPanel = new JPanel();
                    contentPanel.add(toolBarPanel, BorderLayout.NORTH);
                    BorderLayout jPanel1Layout = new BorderLayout();
                    toolBarPanel.setLayout(jPanel1Layout);
                    {
                        jSeparator = new JSeparator();
                        toolBarPanel.add(jSeparator, BorderLayout.SOUTH);
                    }
                    {
                    	mainToolBar = new JToolBar();
                    	toolBarPanel.add(mainToolBar, BorderLayout.CENTER);
                    	{
                    		newButton = new JButton();
                    		mainToolBar.add(newButton);
                    		newButton.setAction( getAppActionMap().get("newFile"));
                    		newButton.setName("ButtonNew");
                    		newButton.setFocusable(false);
                    		newButton.setPreferredSize(new java.awt.Dimension(48, 44));
                    		newButton.setMaximumSize(new java.awt.Dimension(48, 44));
                    		newButton.setMinimumSize(new java.awt.Dimension(48, 44));
                    		newButton.setBorder(BorderFactory.createTitledBorder(""));
                    		newButton.addMouseListener(new MouseAdapter() {
                    			public void mouseClicked(MouseEvent evt) {
                    				guiEvents.newButtonMouseClicked(evt);
                    			}
                    		});
                    	}
                    	{
                    		openButton = new JButton();
                    		mainToolBar.add(openButton);
                    		openButton.setAction(getAppActionMap().get("open"));
                    		openButton.setName("ButtonOpen");
                    		openButton.setFocusable(false);
                    		openButton.setBorder(BorderFactory.createTitledBorder(""));
                    		openButton.setSize(48, 44);
                    		openButton.setMinimumSize(new java.awt.Dimension(48, 38));
                    		openButton.setPreferredSize(new java.awt.Dimension(48, 44));
                    		openButton.setMaximumSize(new java.awt.Dimension(48, 44));
                    	}
                    	{
                    		saveButton = new JButton();
                    		mainToolBar.add(saveButton);
                    		mainToolBar.add(getJPanelToolbarSep1());
                    		mainToolBar.add(getJButtonSingleWindow());
                    		saveButton.setAction(getAppActionMap().get("save"));
                    		saveButton.setName("ButtonSave");
                    		saveButton.setFocusable(false);
                    		saveButton.setBorder(BorderFactory.createTitledBorder(""));
                    		saveButton.setMaximumSize(new java.awt.Dimension(48, 44));
                    		saveButton.setMinimumSize(new java.awt.Dimension(48, 44));
                    		saveButton.setPreferredSize(new java.awt.Dimension(48, 44));
                    		saveButton.setSize(48, 44);
                    	}
                    }
                } // toolBarPanel
                {
                	TabbedPaneMain = new JTabbedPane();
                	TabbedPaneMain.setName("TabbedPaneMain");
                	if (_DEBUG)TabbedPaneMain.setToolTipText("TabbedPaneMain");
                	TabbedPaneMain.setPreferredSize(new java.awt.Dimension( w, basicHeight-20));
                	TabbedPaneMain.setMinimumSize(new java.awt.Dimension(190, 150));
                	TabbedPaneMain.setLocale(new java.util.Locale("de", "CH"));
                	TabbedPaneMain.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
                	TabbedPaneMain.setFont(f14) ;
                	TabbedPaneMain.setOpaque(false);
                	setMappedColor( TabbedPaneMain,new float[]{_dred,_dgreen,_dblue,0.7f}) ; // blueish
                	TabbedPaneMain.setVisible(true) ;
                	
                	contentPanel.add(TabbedPaneMain, BorderLayout.CENTER);
                	contentPanel.add(getJPanelMainStatusBar(), BorderLayout.SOUTH);
                	getJPanelMainStatusBar().setVisible(true);
                	 
                	
                } // TabbedPaneMain
                
                	{
                		// this page contains the main display of the results, !! the ScrollPane is on a pane a further level inside  
                		jPanelFoundTab = new JPanel();
                		BorderLayout jPanelFoundTabLayout = new BorderLayout();
                		jPanelFoundTab.setLayout(jPanelFoundTabLayout);
                		jPanelFoundTab.setName("jPanelFoundTab");
                		if (_DEBUG)jPanelFoundTab.setToolTipText("jPanelFoundTab");
                		jPanelFoundTab.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
                		// 
                		jPanelFoundTab.setOpaque(true);
                		jPanelFoundTab.setVisible(true);
                		// jPanelFoundTab.setBackground( new Color( 0.8f,0.8f,0.2f,0.7f)) ;
                		setMappedColor(jPanelFoundTab, new float[]{_dred,_dgreen,_dblue,0.7f} );
                		
                		TabbedPaneMain.addTab("   Found   ", null, jPanelFoundTab, null);
                		
                		{
                		    		
                    		// this Panel we will actually transfer/relocate, and this also should be transparent on request
                    		PanelFound = new JPanel();
                    		BorderLayout PanelFoundLayout = new BorderLayout();
                			PanelFound.setLayout(PanelFoundLayout);

                			PanelFound.setName("PanelFound");
                			if (_DEBUG)PanelFound.setToolTipText("PanelFound");

                			d = new java.awt.Dimension(150, 141);
                			PanelFound.setMinimumSize(d);

                			d = new java.awt.Dimension(basicWidth, basicHeight-20);
                			PanelFound.setPreferredSize(d);
                			PanelFound.setSize(d);                			
                			
                			PanelFound.setOpaque(true);
                			PanelFound.setVisible(true);
                			
                			setMappedColor(PanelFound, new float[]{_dred,_dgreen,_dblue,0.7f} );
                			PanelFound.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
                			
                			PanelFound.putClientProperty("Window.alpha", 0.4f);
                			jPanelFoundTab.add(PanelFound, BorderLayout.CENTER);
                			
                			JPanel[] panelFoundBorderPanels = createBorderPanels( jPanelFoundTab ,"PanelFoundTabOrnament", false);
                			PanelFoundTabButtonHost = panelFoundBorderPanels[1]; // == East 
                			
                			{
                				jPanelFoundScrollerHost = new JPanel();
                				BorderLayout jPanelFoundScrollerHostLayout = new BorderLayout();
                				jPanelFoundScrollerHost.setLayout(jPanelFoundScrollerHostLayout);
                				
                				jPanelFoundScrollerHost.setName("PanelFoundScrollerHost");
                				if (_DEBUG)jPanelFoundScrollerHost.setToolTipText("PanelFoundScrollerHost");
                				setMappedColor( jPanelFoundScrollerHost, new float[]{_dred*_dd1,_dgreen*_dd1*0.4f,_dblue*_dd1*0.4f,0.93f} );
                				
                				PanelFound.add(jPanelFoundScrollerHost, BorderLayout.CENTER);
                				
                				{	
                					jPanelScrollWrapFoundStack = new JPanel();
                					BoxLayout jPanelScrollWrapFoundStackLayout = new BoxLayout(jPanelScrollWrapFoundStack, javax.swing.BoxLayout.Y_AXIS);
                					jPanelScrollWrapFoundStack.setLayout(jPanelScrollWrapFoundStackLayout);
                					jPanelScrollWrapFoundStack.setSize(d);
                					jPanelScrollWrapFoundStack.setMinimumSize( new Dimension(d.width-25,1000));
                					jPanelScrollWrapFoundStack.setPreferredSize(new java.awt.Dimension(d.width-20, 900));
                					jPanelScrollWrapFoundStack.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
                					setMappedColor( jPanelScrollWrapFoundStack, new float[]{_dred*_dd1,_dgreen*_dd1,_dblue*_dd1,0.93f} );
                				
                					jPanelScrollWrapFoundStack.setName("jPanelScrollWrapFoundStack");
                					if (_DEBUG)jPanelScrollWrapFoundStack.setToolTipText("jPanelScrollWrapFoundStack");
                					
                					jPanelScrollWrapFoundStack.addMouseListener(new MouseAdapter() {
                						public void mouseClicked(MouseEvent evt) {
                							out.print(2, "mouse event on <jPanelScrollWrapFoundStack> detected: clicked : \n");
                							jPanelScrollWrapFoundStackMouseClicked(evt);
                						}
                						
                						public void mouseReleased(MouseEvent evt) {
                							out.print(2, "mouse event on <jPanelScrollWrapFoundStack> detected: pressed and released: \n"+ 
                										 "        - "+evt.getComponent() +"\n"+
                										 "        - "+evt+"\n");
                							if (evt.isPopupTrigger()){
                								out.print(2," ---->>>>  PopupTrigger detected");
                								// panelsTextPaneMouseClicked(evt,panelIndex);
                								windowGui.getResultPanelPopupMenu().getPanelPopupMenu().show(evt.getComponent(), evt.getX(), evt.getY());
                							}
                						}
                						public void mousePressed(MouseEvent evt) {
                							out.print(2, "mouse event on <jPanelScrollWrapFoundStack> detected: pressed : \n"+ 
                										 "        - "+evt.getComponent() +"\n"+
                										 "        - "+evt+"\n");
                							if (evt.isPopupTrigger()){
                								out.print(2," ---->>>>  PopupTrigger detected");
                								// panelsTextPaneMouseClicked(evt,panelIndex);
                								windowGui.getResultPanelPopupMenu().getPanelPopupMenu().show(evt.getComponent(), evt.getX(), evt.getY());
                							}
                						}

                					});
                					


                				// jPanelScrollWrapFoundStack.add(getjPanelScrollDummy());
                				}
                				 
                				{
                					ScrollPaneReturnedResults = new JScrollPane();
                					jPanelFoundScrollerHost.add(ScrollPaneReturnedResults, BorderLayout.CENTER);
                					UIManager.put("List.lockToPositionOnScroll", Boolean.FALSE);

                					// // textArea.setCaretPosition(textArea.getDocument().getLength());
                					ScrollPaneReturnedResults.setPreferredSize(new java.awt.Dimension(d.width-50, 1000));
                					ScrollPaneReturnedResults.setSize(new java.awt.Dimension(d.width-50, 1000));
                					
                					ScrollPaneReturnedResults.setMaximumSize(new java.awt.Dimension( d.width+240, 32767));
                					ScrollPaneReturnedResults.setMinimumSize(new java.awt.Dimension(200, 1000));
                					ScrollPaneReturnedResults.setName("ScrollPaneReturnedResults");
                					if (_DEBUG)ScrollPaneReturnedResults.setToolTipText("ScrollPaneReturnedResults");
                					
                					ScrollPaneReturnedResults.getVerticalScrollBar().setUnitIncrement(8);
                					
                					Dimension dim = new Dimension(basicWidth, basicHeight);
                					ScrollPaneReturnedResults.setPreferredSize(dim);
                					ScrollPaneReturnedResults.setSize(430, basicHeight);
                					setMappedColor(ScrollPaneReturnedResults, new float[]{_dred*_dd1,_dgreen*_dd1,_dblue*_dd1,0.93f} );
                					
                					ScrollPaneReturnedResults.getVerticalScrollBar().setMaximumSize(new java.awt.Dimension(15, 32767));
                					ScrollPaneReturnedResults.getVerticalScrollBar().setPreferredSize(new java.awt.Dimension(15, 48));
                					ScrollPaneReturnedResults.getVerticalScrollBar().setOpaque(false);
                					
                					
                					ScrollPaneReturnedResults.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
                					
                					ScrollPaneReturnedResults.getVerticalScrollBar().addAdjustmentListener(
                												new AdjustmentListener() {
                														public void adjustmentValueChanged(AdjustmentEvent evt) {
                															(new AdvScrolling(windowGui,this)).verticalScrollBarAdjustmentValueChanged(evt);
                														}
                												});

                					ScrollPaneReturnedResults.setViewportView(getjPanelScrollWrapFoundStack());
                				} // ScrollPaneReturnedResults 
                				
                			}// jPanelFoundScrollerHost   
                			
                			
	
                		}
                		
                
                	} // jPanelFoundTab
                
                	

                	{
                		jPanelPGraphics = new JPanel();
                		TabbedPaneMain.addTab("   Graphic   ", null, jPanelPGraphics, null);
                		BorderLayout jPanelPGraphicsLayout = new BorderLayout();
                		jPanelPGraphics.setLayout(jPanelPGraphicsLayout);
                		jPanelPGraphics.setName("jPanelPGraphics");
                		jPanelPGraphics.setVisible(true);
                		jPanelPGraphics.addComponentListener(new ComponentAdapter() {
                			public void componentResized(ComponentEvent evt) {
                				guiEvents.jPanelPGraphicsComponentResized(evt);
                			}
                		});
                		{
                			GraphicPanel = new JPanel();
                			BorderLayout GraphicPanelLayout = new BorderLayout();
                			GraphicPanel.setLayout(GraphicPanelLayout);
                			jPanelPGraphics.add(GraphicPanel, BorderLayout.CENTER);
                			GraphicPanel.setPreferredSize(new java.awt.Dimension(495, 360));
                			
                			{
                				jPanelGPborder[2] = new JPanel();
                				GraphicPanel.add(jPanelGPborder[2], BorderLayout.SOUTH);
                				jPanelGPborder[2].setPreferredSize(new java.awt.Dimension(20000, 20));
                			}
                			{
                				jPanelGPborder[1] = new JPanel();
                				GraphicPanel.add(jPanelGPborder[1], BorderLayout.EAST);
                				jPanelGPborder[2].setPreferredSize(new java.awt.Dimension(20, 500));
                				jPanelGPborder[2].setMaximumSize(new java.awt.Dimension(20, 20000));
                			}
                			{
                				jPanelGPborder[3] = new JPanel();
                				GraphicPanel.add(jPanelGPborder[2], BorderLayout.WEST);
                				jPanelGPborder[3].setPreferredSize(new java.awt.Dimension(16, 221));
                				jPanelGPborder[2].setMaximumSize(new java.awt.Dimension(16, 20000));
                			}
                			{
                				jPanelGPborder[0] = new JPanel();
                				GraphicPanel.add(jPanelGPborder[0], BorderLayout.NORTH);
                				jPanelGPborder[0].setPreferredSize(new java.awt.Dimension(4950, 17));
                			}
                			{
                				jPanelGraphicsHost = new JPanel();
                				BorderLayout jPanelGraphicsHostLayout = new BorderLayout();
                				jPanelGraphicsHost.setLayout(jPanelGraphicsHostLayout);
                				GraphicPanel.add(jPanelGraphicsHost, BorderLayout.CENTER);
                				{
                					canvasProcessingGraphics = new Canvas();
                					jPanelGraphicsHost.add(canvasProcessingGraphics, BorderLayout.CENTER);
                				}
                			}
                		}
                	}
                	
                	
                	{
                		jPanelFocusHost = new JPanel();
                		TabbedPaneMain.addTab("   Focus   ", null, jPanelFocusHost, null);
                		BorderLayout jPanel4Layout = new BorderLayout();
                		jPanelFocusHost.setLayout(jPanel4Layout);
                		jPanelFocusHost.setPreferredSize(new java.awt.Dimension(495, 241));
                		jPanelFocusHost.setName("jPanel4");
                		jPanelFocusHost.addComponentListener(new ComponentAdapter() {
                			public void componentResized(ComponentEvent evt) {
                				guiEvents.jPanelFocusComponentResized(evt);
                			}
                		});
                		{
                			PanelFocus = new JPanel();
                			BorderLayout PanelFocusLayout = new BorderLayout();
                			PanelFocus.setLayout(PanelFocusLayout);
                			jPanelFocusHost.add(PanelFocus, BorderLayout.CENTER);
                			PanelFocus.setPreferredSize(new java.awt.Dimension(495, 180));
                			PanelFocus.addComponentListener(new ComponentAdapter() {
                				public void componentResized(ComponentEvent evt) {
                					guiEvents.PanelFocusComponentResized(evt);
                				}
                			});
                			{
                				jPanelFocusContentMain = new JPanel();
                				BorderLayout jPanel6Layout = new BorderLayout();
                				jPanelFocusContentMain.setLayout(jPanel6Layout);
                				PanelFocus.add(jPanelFocusContentMain, BorderLayout.WEST);
                				jPanelFocusContentMain.setPreferredSize(new java.awt.Dimension(472, 339));
                				jPanelFocusContentMain.addComponentListener(new ComponentAdapter() {
                					public void componentResized(ComponentEvent evt) {
                						guiEvents.jPanelFocusContentMainComponentResized(evt);
                					}
                				});
                				{
                					jTabbedPaneFocus = new JTabbedPane();
                					jTabbedPaneFocus.setFont(f13) ;
                					jPanelFocusContentMain.add(jTabbedPaneFocus, BorderLayout.CENTER);
                					jTabbedPaneFocus.setPreferredSize(new java.awt.Dimension(409, 198));
                					jTabbedPaneFocus.setName("TabbedPane_FocusParameters");
                					jTabbedPaneFocus.setMaximumSize(new java.awt.Dimension(450, 32767));
                					{
                						PanelFocusNormal = new JPanel();
                						jTabbedPaneFocus.addTab("  normal  ", null, PanelFocusNormal, null);
                						BorderLayout PanelFocusNormalLayout = new BorderLayout();
                						PanelFocusNormal.setLayout(PanelFocusNormalLayout);
                						PanelFocusNormal.setName("PanelFocusNormal");

                						
                						{
                							jPanelFocusNormalBottom = new JPanel();
                							BorderLayout jPanelFocusNormalBottomLayout = new BorderLayout();
                							jPanelFocusNormalBottom.setLayout(jPanelFocusNormalBottomLayout);
                							PanelFocusNormal.add(jPanelFocusNormalBottom, BorderLayout.SOUTH);
                							jPanelFocusNormalBottom.setPreferredSize(new java.awt.Dimension(391, 56));
                							{
                								jPanelFocusNormalFileDropArea = new JPanel();
                								BorderLayout jPanelFocusNormalFileDropAreaLayout = new BorderLayout();
                								jPanelFocusNormalFileDropArea.setLayout(jPanelFocusNormalFileDropAreaLayout);
                								jPanelFocusNormalBottom.add(jPanelFocusNormalFileDropArea, BorderLayout.WEST);
                								jPanelFocusNormalFileDropArea.setPreferredSize(new java.awt.Dimension(343, 25));
                								jPanelFocusNormalFileDropArea.setName("jPanelFocusNormalFileDropArea");
                								{
                									jFocusNormalTextAreaFileDrop = new JTextArea();
                									jPanelFocusNormalFileDropArea.add(jFocusNormalTextAreaFileDrop, BorderLayout.EAST);
                									jFocusNormalTextAreaFileDrop.setName("jFocusNormalTextAreaFileDrop");
                									jFocusNormalTextAreaFileDrop.setPreferredSize(new java.awt.Dimension(295, 25));
                									jFocusNormalTextAreaFileDrop.setText(" drop your file here...");
                									jFocusNormalTextAreaFileDrop.setEditable(false);
                									jFocusNormalTextAreaFileDrop.setBackground(new Color(212, 208, 200));
                									// FIXMEset borderlayout programmatically to CENTER jPanelFocusNormalFileDropArea.
                									
                									jFocusNormalTextAreaFileDrop.addMouseListener(new MouseAdapter() {
                										private AbstractButton jFocusNormalTextAreaFileDrop;

														public void mouseClicked(MouseEvent evt) {
                											clics = guiEvents.jTextAreaFileDropMouseClicked(evt);
                											
                											System.err.println("-----  number of clicks : "+ clics) ;
                											if (clics == 2){
                												jFocusNormalTextAreaFileDrop.setText("");
                											}
                											
                										}
                									});
                									
                									
                									{
                										// System.out, null = no output
                										new FileDrop( null, jFocusNormalTextAreaFileDrop, new FileDrop.Listener() {
                											public void filesDropped(java.io.File[] files) {
                												
                												for (int i = 0; i < files.length; i++) {
                													try {
                														String filename; 
                														filename = files[i].getCanonicalPath();
                														if (DFutils.fileExists(filename)){
                															jFocusNormalTextAreaFileDrop.setText("");
                															jFocusNormalTextAreaFileDrop.append(filename );// + "\n"
                															// trigger action to handle the file
                														}
                														// only if it is indeed a file
                														if (i>=0){ // TODO: make a constant for it, 
                															// it is also dependent on the size of the docs
                															break;
                														}
                													} // end try
                													catch (java.io.IOException e) {
                													}
                												} // end for: through each dropped
                												// file
                											} // end filesDropped
                										}); // end FileDrop.Listener
                										
                									}
                									
                									
                								}
                								{
                									jPanelFocusFileDropOrnamentWest = new JPanel();
                									jPanelFocusNormalFileDropArea.add(jPanelFocusFileDropOrnamentWest, BorderLayout.WEST);
                								}
                								
                							}
                							{
                								jPanelFocusNormalLabelContainer = new JPanel();
                								jPanelFocusNormalBottom.add(jPanelFocusNormalLabelContainer, BorderLayout.SOUTH);
                								jPanelFocusNormalLabelContainer.setPreferredSize(new java.awt.Dimension(104, 24));
                								jPanelFocusNormalLabelContainer.setName("jPanelFocusNormalLabelContainer");
                								
                								
                								{
                									jLabelFocusNormal = new JLabel();
                									jPanelFocusNormalLabelContainer.add(jLabelFocusNormal, BorderLayout.SOUTH);
                									jLabelFocusNormal.setName("jLabelNormalExplanation");
                									;
                									jLabelFocusNormal.setPreferredSize(new java.awt.Dimension(391, 21));
                									
                								}
                								
                								
                							}
                							{
                								jPanelFocusNormalBottomN = new JPanel();
                								jPanelFocusNormalBottom.add(jPanelFocusNormalBottomN, BorderLayout.NORTH);
                								jPanelFocusNormalBottomN.setPreferredSize(new java.awt.Dimension(391, 6));
                							}
                						}
                						{
                							TextNormal = new JTextArea();
                							PanelFocusNormal.add(TextNormal, BorderLayout.CENTER);
                							TextNormal.setName("TextNormal");
                							Dimension dFocusText = new java.awt.Dimension(180, 60);
                							TextNormal.setPreferredSize( dFocusText );
                							TextNormal.setSize( dFocusText );
                							TextNormal.setMaximumSize( dFocusText );
                							
                							prepareAsFocusTextArea(TextNormal);
                						}
                					} // TextNormal, TextMandatory, TextExclude, TextTolerated
                					{
                						PanelFocusMandatory = new JPanel();
                						jTabbedPaneFocus.addTab("  mandatory  ", null, PanelFocusMandatory, null);
                						BorderLayout PanelFocusMandatoryLayout = new BorderLayout();
                						PanelFocusMandatory.setLayout(PanelFocusMandatoryLayout);
                						PanelFocusMandatory.setName("PanelFocusMandatory");
                						{
                							TextMandatory = new JTextArea();
                							PanelFocusMandatory.add(TextMandatory, BorderLayout.CENTER);
                							// keylistener to register changes, which then is passed to appCommons as a flag
                							prepareAsFocusTextArea(TextMandatory);
                						}
                						{
                							jLabelFocusMandatory = new JLabel();
                							PanelFocusMandatory.add(jLabelFocusMandatory, BorderLayout.SOUTH);
                							jLabelFocusMandatory.setName("jLabelmandatory");
                							
                							jLabelFocusMandatory.setPreferredSize(new java.awt.Dimension(391, 21));
                						}
                					}
                					{
                						PanelFocusExcludes = new JPanel();
                						jTabbedPaneFocus.addTab("  excluding  ", null, PanelFocusExcludes, null);
                						BorderLayout PanelFocusExcludesLayout = new BorderLayout();
                						PanelFocusExcludes.setLayout(PanelFocusExcludesLayout);
                						PanelFocusExcludes.setName("PanelFocusExcludes");
                						{
                							TextExclude = new JTextArea();
                							PanelFocusExcludes.add(TextExclude, BorderLayout.CENTER);
                							prepareAsFocusTextArea(TextExclude);
                						}
                						{
                							jLabelFocusExcludes = new JLabel();
                							PanelFocusExcludes.add(jLabelFocusExcludes, BorderLayout.SOUTH);
                							jLabelFocusExcludes.setName("jLabel333");
                							jLabelFocusExcludes.setName("jLabel333");
                						}
                						{
                							jLabelFocusExcludes2 = new JLabel();
                							PanelFocusExcludes.add(jLabelFocusExcludes2, BorderLayout.SOUTH);
                							jLabelFocusExcludes2.setName("jLabel5");
                							jLabelFocusExcludes2.setPreferredSize(new java.awt.Dimension(391, 21));
                						}
                					}
                					{
                						
                						
                						PanelFocusTolerated = new JPanel();
                						jTabbedPaneFocus.addTab("  tolerated  ", null, PanelFocusTolerated, null);
                						BorderLayout PanelFocusToleratedLayout = new BorderLayout();
                						PanelFocusTolerated.setLayout(PanelFocusToleratedLayout);
                						PanelFocusTolerated.setName("PanelFocusTolerated");
                						{
                							TextTolerated = new JTextArea();
                							PanelFocusTolerated.add(TextTolerated, BorderLayout.CENTER);
                							prepareAsFocusTextArea(TextTolerated);
                						}
                						{
                							jLabelFocusTolerated = new JLabel();
                							PanelFocusTolerated.add(jLabelFocusTolerated, BorderLayout.SOUTH);
                							jLabelFocusTolerated.setName("jLabel4");
                						}
                						{
                							jLabelFocusTolerated2 = new JLabel();
                							PanelFocusTolerated.add(jLabelFocusTolerated2, BorderLayout.SOUTH);
                							jLabelFocusTolerated2.setName("jLabel6");
                							jLabelFocusTolerated2.setPreferredSize(new java.awt.Dimension(391, 21));
                						}
                						
                						
                					}
                					jTabbedPaneFocus.addComponentListener(new ComponentAdapter() {
                						public void componentMoved(ComponentEvent evt) {
                							guiEvents.jTabbedPaneFocusComponentMoved(evt);
                						}
                						public void componentResized(ComponentEvent evt) {
                							guiEvents.jTabbedPaneFocusComponentResized(evt);
                						}
                					});
                				}
                				{
                					jPanelFocusExplanation = new JPanel();
                					jPanelFocusContentMain.add(jPanelFocusExplanation, BorderLayout.NORTH);
                					jPanelFocusExplanation.setPreferredSize(new java.awt.Dimension(472, 63));
                					jPanelFocusExplanation.setLayout(null);
                					{
                						LabelFocusExplanation = new JLabel();
                						jPanelFocusExplanation.add(LabelFocusExplanation);
                						LabelFocusExplanation.setName("LabelFocusExplanation");
                						LabelFocusExplanation.setBounds(33, 5, 419, 18);
                						LabelFocusExplanation.setText("Here you may configure a particular focus for your interaction with iTexx.");
                						
                					}
                					{
                						LabelFocusExplanation2 = new JLabel();
                						jPanelFocusExplanation.add(LabelFocusExplanation2);
                						LabelFocusExplanation2.setName("LabelFocusExplanation2");
                						LabelFocusExplanation2.setBounds(33, 20, 406, 21);
                						LabelFocusExplanation2.setText("Note that all items are evaluated singularly.");
                					}
                					{
                						LabelFocusExplanation3 = new JLabel();
                						jPanelFocusExplanation.add(LabelFocusExplanation3);
                						LabelFocusExplanation3.setBounds(33, 39, 399, 14);
                						LabelFocusExplanation3.setName("LabelFocusExplanation3");
                						LabelFocusExplanation3.setText("Enter items separated by commas (,) by semi-colons (;) or by row.");
                					}
                				}
                				{
                					jPanelFocusContentOrnamentW = new JPanel();
                					jPanelFocusContentMain.add(jPanelFocusContentOrnamentW, BorderLayout.WEST);
                					jPanelFocusContentOrnamentW.setPreferredSize(new java.awt.Dimension(32, 16));
                					jPanelFocusContentOrnamentW.setName("jPanel8");
                				}
                				{
                					jPanelFocusContentButtonHost = new JPanel();
                					jPanelFocusContentButtonHost.setLayout(null);
                					jPanelFocusContentButtonHost.setName("jPanel9");
                					jPanelFocusContentMain.add(jPanelFocusContentButtonHost, BorderLayout.EAST);
                					jPanelFocusContentButtonHost.setPreferredSize(new java.awt.Dimension(44, 275));
                					{
                						jPanelFocusContentButtonArea1 = new JPanel();
                						jPanelFocusContentButtonArea1.setName("jPanel10");
                						jPanelFocusContentButtonHost.add(jPanelFocusContentButtonArea1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                						jPanelFocusContentButtonArea1.setLayout(null);
                						jPanelFocusContentButtonArea1.setBounds(10, 24, 34, 86);
                						{
                							jButtonFocusContent1 = new JButton();
                							jPanelFocusContentButtonArea1.add(jButtonFocusContent1);
                							jButtonFocusContent1.setBounds(6, 11, 24, 23);
                							jButtonFocusContent1.setName("jButton1");
                						}
                					}
                				}
                				{
                					PanelFocusExplanation = new JPanel();
                					jPanelFocusContentMain.add(PanelFocusExplanation, BorderLayout.SOUTH);
                					PanelFocusExplanation.setPreferredSize(new java.awt.Dimension(347, 24));
                					PanelFocusExplanation.setLayout(null);
                				}
                			}
                		}
                	}
                	{
                		jPanelHistoryTree = new JPanel();
                		TabbedPaneMain.addTab("   History   ", null, jPanelHistoryTree, null);
                		BorderLayout jPanelHistoryTreeLayout = new BorderLayout();
                		jPanelHistoryTree.setLayout(jPanelHistoryTreeLayout);
                		jPanelHistoryTree.setName("jPanelHistoryTree");
                		jPanelHistoryTree.setVisible(true);
                		
                		jPanelHistoryTree.addComponentListener(new ComponentAdapter() {
                			public void componentResized(ComponentEvent evt) {
                				guiEvents.jPanelHistoryTreeComponentResized(evt);
                			}
                		});
                		
                		jPanelHistoryTree.addKeyListener(new KeyAdapter() {
                			public void keyPressed(KeyEvent evt) {
                				guiEvents.jPanelHistoryTreeKeyPressed(evt);
                			}
                		});
                		
                		{
                			PanelRequest = new JPanel();
                			BorderLayout PanelRequestLayout = new BorderLayout();
                			PanelRequest.setLayout(PanelRequestLayout);
                			jPanelHistoryTree.add(PanelRequest, BorderLayout.CENTER);
                			PanelRequest.setPreferredSize(new java.awt.Dimension(403, 335));
                			{
                				jTreeRequestsHistory = new JTree();
                				PanelRequest.add(jTreeRequestsHistory, BorderLayout.CENTER);
                				PanelRequest.add(getJPanelReqHistoryTop(), BorderLayout.NORTH);
                				jTreeRequestsHistory.setName("jTreeRequestsHistory");
                				jTreeRequestsHistory.setFont(f14) ;
                				jTreeRequestsHistory.setPreferredSize(new java.awt.Dimension(14, 311));
                			}
                		}
                		
                		
                		{
                			jPanelLeft = new JPanel();
                			jPanelHistoryTree.add(jPanelLeft, BorderLayout.WEST);
                			jPanelLeft.setPreferredSize(new java.awt.Dimension(10, 335));
                			jPanelLeft.setMaximumSize(new java.awt.Dimension(10, 32767));
                		}
                		{
                			PanelReqRight = new JPanel();
                			jPanelHistoryTree.add(PanelReqRight, BorderLayout.EAST);
                			PanelReqRight.setPreferredSize(new java.awt.Dimension(60, 335));
                			PanelReqRight.setLayout(null);
                			PanelReqRight.setMinimumSize(new java.awt.Dimension(60, 10));
                			PanelReqRight.setMaximumSize(new java.awt.Dimension(60, 32767));
                		}
                		{
                			PanelReqBottom = new JPanel();
                			jPanelHistoryTree.add(PanelReqBottom, BorderLayout.SOUTH);
                			PanelReqBottom.setPreferredSize(new java.awt.Dimension(487, 24));
                			PanelReqBottom.setMaximumSize(new java.awt.Dimension(32767, 24));
                		}
                	}

                	{
                		jPanelWebMeta = new JPanel();
                		TabbedPaneMain.addTab("   Meta Items    ", null, jPanelWebMeta, null);
                		BorderLayout jPanelWebMetaLayout = new BorderLayout();
                		jPanelWebMeta.setLayout(jPanelWebMetaLayout);
                		jPanelWebMeta.setName("jPanelWebMeta");
                		jPanelWebMeta.addFocusListener(new FocusAdapter() {
                			public void focusLost(FocusEvent evt) {
                				guiEvents.jPanelWebMetaFocusLost(evt);
                			}
                			public void focusGained(FocusEvent evt) {
                				guiEvents.jPanelWebMetaFocusGained(evt);
                			}
                		});
                		jPanelWebMeta.addMouseWheelListener(new MouseWheelListener() {
                			public void mouseWheelMoved(MouseWheelEvent evt) {
                				guiEvents.jPanelWebMetaMouseWheelMoved(evt);
                			}
                		});
                		jPanelWebMeta.addMouseListener(new MouseAdapter() {
                			public void mouseClicked(MouseEvent evt) {
                				guiEvents.jPanelWebMetaMouseClicked(evt);
                			}
                		});
                		jPanelWebMeta.addKeyListener(new KeyAdapter() {
                			public void keyPressed(KeyEvent evt) {
                				guiEvents.jPanelWebMetaKeyPressed(evt);
                			}
                		});
                		jPanelWebMeta.addComponentListener(new ComponentAdapter() {
                			public void componentResized(ComponentEvent evt) {
                				guiEvents.jPanelWebMetaComponentResized(evt,jPanelReqTop,jPanelMetaReqTextFieldHost,TextFieldDedicatedSearch);
                			}
                		});
                		
                		{
                			jPanelReqTop = new JPanel();
                			jPanelWebMeta.add(jPanelReqTop, BorderLayout.NORTH);
                			jPanelReqTop.setPreferredSize(new java.awt.Dimension(515, 99));
                			jPanelReqTop.setLayout(null);
                			jPanelReqTop.setMaximumSize(new java.awt.Dimension(500, 99));
                			jPanelReqTop.setMinimumSize(new java.awt.Dimension(100, 99));
                			{
                				jPanelMetaReqTextFieldHost = new JPanel();
                				jPanelMetaReqTextFieldHost.setName("jPanel11");
                				BorderLayout jPanel11Layout = new BorderLayout();
                				jPanelMetaReqTextFieldHost.setLayout(jPanel11Layout);
                				jPanelReqTop.add(jPanelMetaReqTextFieldHost);
                				jPanelMetaReqTextFieldHost.setBounds(36, 11, 470, 37);
                				// jPanelMetaReqTextFieldHost.setBackground(new Color(0.8f,0.8f,0.6f,1f));
                				{
                					TextFieldDedicatedSearch = new JTextField();
                					jPanelMetaReqTextFieldHost.add(TextFieldDedicatedSearch, BorderLayout.WEST);
                					TextFieldDedicatedSearch.setName("TextFieldDedicatedSearch");
                					TextFieldDedicatedSearch.setPreferredSize(new java.awt.Dimension(380, 37));
                					TextFieldDedicatedSearch.setText("dedicated classic search...");
                					TextFieldDedicatedSearch.setFont(f16) ;
                					TextFieldDedicatedSearch.setForeground( new Color(222,218,210)) ;
                					TextFieldDedicatedSearch.setMaximumSize(new java.awt.Dimension(900, 32));
                					TextFieldDedicatedSearch.setMinimumSize(new java.awt.Dimension(90, 32));
                					TextFieldDedicatedSearch.setSize(430, 35);
                					TextFieldDedicatedSearch.setLocation(new java.awt.Point(2, 0));
                					TextFieldDedicatedSearch.setMargin(new java.awt.Insets(2, 0, 0, 0));

                					TextFieldDedicatedSearch.addKeyListener(new KeyAdapter() {
                						public void keyReleased(KeyEvent evt) {
                							guiEvents.TextFieldDedicatedSearchKeyReleased(evt);
                						}
                					});
                					
                					TextFieldDedicatedSearch.addMouseListener(new MouseAdapter() {
                						public void mouseClicked(MouseEvent evt) {
                							guiEvents.TextFieldDedicatedSearchMouseClicked(evt);
                						}
                					});

                				}
                				{
                					jPanelMetaReqOrnamentE = new JPanel();
                					jPanelMetaReqOrnamentE.setName("jPanel13");
                					jPanelMetaReqTextFieldHost.add(jPanelMetaReqOrnamentE, BorderLayout.EAST);
                					jPanelMetaReqOrnamentE.setLayout(null);
                					jPanelMetaReqOrnamentE.setBounds(444, 11, 16, 37);
                					jPanelMetaReqOrnamentE.setPreferredSize(new java.awt.Dimension(13, 37));
                				}
                			}
                			{
                				jPanelMetaReqFiledropHost = new JPanel();
                				jPanelMetaReqFiledropHost.setName("jPanel12");
                				BorderLayout jPanel12Layout = new BorderLayout();
                				jPanelMetaReqFiledropHost.setLayout(jPanel12Layout);
                				jPanelReqTop.add(jPanelMetaReqFiledropHost);
                				jPanelMetaReqFiledropHost.setBounds(36, 54, 447, 44);

                				{
                					PanelFileAreaSeparator1 = new JPanel();
                					PanelFileAreaSeparator1.setLayout(null);
                					jPanelMetaReqFiledropHost.add(PanelFileAreaSeparator1, BorderLayout.NORTH);
                					PanelFileAreaSeparator1.setMaximumSize(new java.awt.Dimension(14, 22));
                					PanelFileAreaSeparator1.setMinimumSize(new java.awt.Dimension(1, 22));
                					PanelFileAreaSeparator1.setPreferredSize(new java.awt.Dimension(447, 38));
                					{
                						// jTextAreaFileDrop = new JTextArea();
                						final javax.swing.JTextArea jTextAreaFileDrop = new javax.swing.JTextArea();
                						PanelFileAreaSeparator1.add(jTextAreaFileDrop);
                						jTextAreaFileDrop.setEditable(false);
                						jTextAreaFileDrop.setText(" drop your file here...");
                						jTextAreaFileDrop.setBackground(new Color(212, 208, 200));
                						
                						jTextAreaFileDrop.setName("jTextAreaFileDrop");
                						jTextAreaFileDrop.setMinimumSize(new java.awt.Dimension(200, 40));
                						jTextAreaFileDrop.setMaximumSize(new java.awt.Dimension(400, 40));
                						jTextAreaFileDrop.setBounds(3, 6, 367, 28);

                						jTextAreaFileDrop.addMouseListener(new MouseAdapter() {
                							public void mouseClicked(MouseEvent evt) {
                								clics =guiEvents.jTextAreaFileDropMouseClicked(evt);
                								
                								System.err.println("-----  number of clicks : "+ clics) ;
                								if (clics == 2){
                									jTextAreaFileDrop.setText("");
                								}
                								
                							}
                						});
                						
                						
                						
                						{
                							// System.out, null = no output
                							new FileDrop( null, jTextAreaFileDrop, new FileDrop.Listener() {
                								public void filesDropped(java.io.File[] files) {
                									
                									for (int i = 0; i < files.length; i++) {
                										try {
                											String filename; 
                											filename = files[i].getCanonicalPath();
                											if (DFutils.fileExists(filename)){
                												jTextAreaFileDrop.setText("");
                												jTextAreaFileDrop.append(filename );// + "\n"
                												// trigger action to handle the file
                											}
                											// only if it is indeed a file
                											break;
                										} // end try
                										catch (java.io.IOException e) {
                										}
                									} // end for: through each dropped
                									// file
                								} // end filesDropped
                							}); // end FileDrop.Listener
                							
                						}
                					}
                					{
                						ButtonRequestOpenFile = new JButton();
                						PanelFileAreaSeparator1.add(ButtonRequestOpenFile);
                						PanelFileAreaSeparator1.add(getJPanelMetaReqOrnamentI());
                						ButtonRequestOpenFile.setName("ButtonRequestOpenFile");
                						ButtonRequestOpenFile.setPreferredSize(new java.awt.Dimension(35, 31));
                						ButtonRequestOpenFile.setSize(35, 27);
                						ButtonRequestOpenFile.setBounds(376, 5, 35, 31);
                					}
                				}

                			}
                		}
                		
                		// PanelMetaSearchBrowser.setPreferredSize(new java.awt.Dimension(495, 131));
                		 
                		{
                			PanelMetaSearchBrowser = new JPanel();
                			BorderLayout PanelMetaSearchBrowserLayout = new BorderLayout();
                			PanelMetaSearchBrowser.setLayout(PanelMetaSearchBrowserLayout);
                			jPanelWebMeta.add(PanelMetaSearchBrowser, BorderLayout.CENTER);
                			PanelMetaSearchBrowser.setName("PanelMetaSearchBrowser");

                			PanelMetaSearchBrowser.setBackground(new Color(226,208,200));
                			
                    		// PrintLog.Print(2, "jPanelWebMeta stuffing with browser...");
                        	// guiFinisher.getBrowser() ;
                    		// mainFrame.setComponentZOrder( PanelMetaSearchBrowser,999) ;
                		}
                		

                }// TabbedPaneMain
                	
                	
			} // contentPanel
			
			guiEvents.jPanelWebMetaComponentResized(null,jPanelReqTop,jPanelMetaReqTextFieldHost,TextFieldDedicatedSearch);
			/*
			windowAppearance.addComponent( parentBasePanel,1, 0f,1f) ;
			windowAppearance.addComponent( parentBasePanel,2) ;
			
			windowAppearance.addComponent( PanelFound,1, 0f,1f) ;
			windowAppearance.addComponent( PanelFound,2) ;
			
			windowAppearance.addComponent( contentPanel,1, 0f,1f) ;
			windowAppearance.addComponent( contentPanel,2) ;
			
			windowAppearance.addComponent( jPanelFoundScrollerHost,1, 0f,1f) ;
			windowAppearance.addComponent( jPanelFoundScrollerHost,2) ;

			windowAppearance.addComponent( jPanelScrollWrapFoundStack,1, 0f,1f) ;
			windowAppearance.addComponent( jPanelScrollWrapFoundStack,2) ;

			windowAppearance.addComponent( ScrollPaneReturnedResults,1, 0f,1f) ;
			windowAppearance.addComponent( ScrollPaneReturnedResults,2) ;
			*/  			
		/*
		// now some gimmick panels
		{
			jPanel1 = new JPanel();
			jPanel1.setOpaque(true);
			jPanel1.setVisible(true);
			// no alpha-value-based transparency needed here
			// just a normal color
			jPanel1.setBackground(new Color(0.1f,0.1f,0.1f,0.3f)) ;
			// probably important for MAC OSX? 
			jPanel1.putClientProperty("Window.alpha", 0.4f);
			
			WindowUtils.setWindowTransparent(frame, true);
		    //WindowUtils.setWindowAlpha(this, transparencyOfVisible);
			
			
			FlowLayout jPanel1Layout = new FlowLayout();
			jPanel1Layout.setAlignment(FlowLayout.LEFT);
			jPanel1.setLayout(jPanel1Layout);
			 
			d = new Dimension(132, 124);
			jPanel1.setPreferredSize( d);
			jPanel1.setMinimumSize( d);
			jPanel1.setSize( d);
			
			jPanel1.setFocusable(true);
			jPanel1.setEnabled(true);

			parentBasePanel.add(jPanel1);
		}
		
		
		
		{
			jPanel2 = new BoldPanel(new Color(0.5f,0.8f,0.5f,0.95f));
			// this will not change anything: jPanel2.putClientProperty("Window.alpha", 0.99f);
			// not that overwriting PaintComponent is also without effect
			jPanel2.setOpaque(false);
			
			jPanel2.setPreferredSize(new java.awt.Dimension(254, 161));
			jPanel2.setName("jPanel2");
			
			jPanel2.setFocusable(true);
			jPanel2.setEnabled(true);

			
			parentBasePanel.add(jPanel2);
		}
		{
			// for inserting the PNG graphics, the BackgroundPanel overwrites the paintComponent() method, 
			// (only a small part of this class is shown in the comment)  
			
			// 	protected void paintComponent(Graphics g) {
	    	//		super.paintComponent(g); 
	    	//		if(image != null) {
	        //			g.drawImage(image, 0,0,this.getWidth(),this.getHeight(),this);
	    	//		}
			//	}
			
			jPanelImgPng = new BackgroundPanel(); // draws a PNG 
			jPanelImgPng.setOpaque(false);

			//quite exciting: this enforces transparency, even if the parent is opaque.
			// without that, it also would become opaque
			jPanelImgPng.setBackground( new Color(0.5f,0.5f,0.5f));// ,0.75f)) ;
			jPanelImgPng.setPreferredSize(new java.awt.Dimension(214, 265));
			jPanelImgPng.setName("jPanelImgPng");
			parentBasePanel.add(jPanelImgPng);
			// jPanelImgPng.putClientProperty("Window.alpha", 0.8f);
		}
		
		{
			String textstr = " and it works also with a transparent Textpanel, where we overwrite paint()";
			
			txtPane = new TransparentTextPane( null, 0.5f, textstr);
			txtPane.setForeground(new Color(0f,0f,0f));
			Font f15 = new Font("Tahoma", 15, 15);
			txtPane.setFont(f15);
			d = new Dimension(282, 145);
			txtPane.setPreferredSize( d);
			parentBasePanel.add(txtPane) ;

			txtPane.setFocusable(true);
			txtPane.setEnabled(true);

		}
		*/


			
		appKeyListener = new ItexxGuiKeyListener( windowAppearance );
		
		// iTexxWindowApp.show( getTopPanel());
		
	}

	protected void jPanelScrollWrapFoundStackMouseClicked(MouseEvent evt) {
		// 
		System.out.println("jPanelScrollWrapFoundStack.mouseClicked, event="+evt);
		// clear clipBoard
	}


	private void prepareAsFocusTextArea(JTextArea textArea) {
		
		textArea.setLineWrap(true);
		textArea.setWrapStyleWord(true);
		
		textArea.addKeyListener(new KeyAdapter() {
			public void keyPressed(KeyEvent evt) {
				FocusTextKeyPressed(evt);
				
			}
		});
		
	}
	private void FocusTextKeyPressed(KeyEvent evt) {
		// System.out.println("TextNormal.keyPressed, event="+evt);
		appCommons.setFocusInputHasChanged(true);
	}
	
	
	private JPanel getJPanelToolbarSep1() {
		if(jPanelToolbarSep1 == null) {
			jPanelToolbarSep1 = new JPanel();
			jPanelToolbarSep1.setPreferredSize(new java.awt.Dimension(48, 37));
			jPanelToolbarSep1.setMaximumSize(new java.awt.Dimension(355, 37));
			jPanelToolbarSep1.setMinimumSize(new java.awt.Dimension(55, 37));
		}
		return jPanelToolbarSep1;
	}
	
	private JButton getJButtonSingleWindow() {
		if(jButtonSingleWindow == null) {
			jButtonSingleWindow = new JButton();
			jButtonSingleWindow.setName("jButtonSingleWindow");
			jButtonSingleWindow.setBorder(BorderFactory.createTitledBorder(""));
			jButtonSingleWindow.setPreferredSize(new java.awt.Dimension(48, 44));
			jButtonSingleWindow.setMaximumSize(new java.awt.Dimension(48, 44));
			jButtonSingleWindow.setMinimumSize(new java.awt.Dimension(48, 44));
			jButtonSingleWindow.addKeyListener(new KeyAdapter() {
				public void keyPressed(KeyEvent evt) {
					guiEvents.jButtonSingleWindowKeyPressed(evt);
				}
			});
			jButtonSingleWindow.addMouseListener(new MouseAdapter() {
				public void mouseClicked(MouseEvent evt) {
					guiEvents.jButtonSingleWindowMouseClicked(evt);
				}
			});
		}
		return jButtonSingleWindow;
	}
	
	public JButton getjButtonSingleWindow() {
		return jButtonSingleWindow;
	}



	private ActionMap getAppActionMap() {
	    return Application.getInstance().getContext().getActionMap(this);
	}


	private JPanel getJPanelMetaReqOrnamentI() {
		if(jPanelMetaReqOrnamentI == null) {
			jPanelMetaReqOrnamentI = new JPanel();
			jPanelMetaReqOrnamentI.setPreferredSize(new java.awt.Dimension(28, 27));
			jPanelMetaReqOrnamentI.setLayout(null);
			jPanelMetaReqOrnamentI.setBounds(416, 7, 28, 27);
		}
		return jPanelMetaReqOrnamentI;
	}



	private void setlookandfeel() {
		
		try {
			// Set cross-platform Java L&F (also called "Metal")
			
			// UIManager.setLookAndFeel(UIManager.get);
			UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
			
			// 
			
		} catch (UnsupportedLookAndFeelException e) {
			// handle exception
		} catch (ClassNotFoundException e) {
			// handle exception
		} catch (InstantiationException e) {
			// handle exception
		} catch (IllegalAccessException e) {
			// handle exception
		}
		
	}

	private JPanel[] createBorderPanels(JPanel hostingPanel, String namesnip, boolean opaque ) {
		// 
		JPanel[] borderPanels = new JPanel[4];
		{
			borderPanels[0] = new JPanel();
			jPanelFoundTab.add(borderPanels[0], BorderLayout.NORTH);
			borderPanels[0].setMaximumSize(new java.awt.Dimension(32767, 10));
			borderPanels[0].setName(namesnip+"N");
			
		}
		{
			borderPanels[1] = new JPanel();
			jPanelFoundTab.add(borderPanels[1], BorderLayout.EAST);
			borderPanels[1].setPreferredSize(new java.awt.Dimension(60, 221));
			borderPanels[1].setMaximumSize(new java.awt.Dimension(60, 9000));
			borderPanels[0].setName(namesnip+"E");
		}
		{
			borderPanels[2] = new JPanel();
			jPanelFoundTab.add(borderPanels[2], BorderLayout.SOUTH);
			borderPanels[2].setMaximumSize(new java.awt.Dimension(32767, 10));
			borderPanels[2].setName(namesnip+"S");
		}
		{
			borderPanels[3] = new JPanel();
			jPanelFoundTab.add(borderPanels[3], BorderLayout.WEST);
			borderPanels[3].setMaximumSize(new java.awt.Dimension(10,32767));
			borderPanels[3].setName(namesnip+"W");
		}
		
		for (int i=0;i<3;i++){
			borderPanels[i].setOpaque(opaque);
			borderPanels[i].setBackground( new Color( _dred,_dgreen,_dblue )) ;
		}

		return borderPanels;
	}
	@Override
	public void setAppCommons(ITexxWindowCommons appcommons) {
		// 
		appCommons = appcommons;
	}


	public ITexxWindowCommons getAppCommons() {
		return appCommons;
	}


	@Override
	public ITexxWindowIntf getTexxWindowApp() {
		return iTexxWindowApp;
	}


	public ItexxModelController getItexxModel() {
		return itexxModel;
	}


	public ITexxWindowGuiFormSettings getWindowGuiFormSettings() {
		return guiFormSettings;
	}


	@Override
	public PrintLog getOut() {
		// 
		return out;
	}


	public void setXpos(int xpos) {
		this.xpos = xpos;
	}


	public int getXpos() {
		return xpos;
	}


	public WindowAppearanceIntf getWindowAppearance() {
		return windowAppearance;
	}


	public ItexxGuiKeyListener getAppKeyListener() {
		return appKeyListener;
	}


	public void setAppKeyListener(ItexxGuiKeyListener appKeyListener) {
		this.appKeyListener = appKeyListener;
	}


	@Override
	public JPanel getPanelFound() {
		return PanelFound;
	}


	@Override
	public JPanel getPanelFoundTab() {
		return jPanelFoundTab ;
	}


	public JTabbedPane getTabbedPaneMain() {
		return TabbedPaneMain;
	}


	@Override
	public JPanel getTopPanel() {
		return parentBasePanel;
	}

	@Override
	public JFrame getMainFrame() {
		return frame;
	}
	

	@Override
	public JToolBar getMainToolBar() {
		// 
		return mainToolBar;
	}


	/**
	 * this panel contains the TabbedPane
	 */
	@Override
	public JPanel getContentPanel() {
		return contentPanel; 
	}


	@Override
	public JTextArea getTextNormal() {
		// 
		return TextNormal;
	}


	@Override
	public JTextArea getTextMandatory() {
		// 
		return TextMandatory;
	}


	@Override
	public JTextArea getTextExclude() {
		// 
		return TextExclude;
	}


	@Override
	public JTextArea getTextTolerated() {
		// 
		return TextTolerated;
	}


	@Override
	public JTextArea getFocusNormalTextAreaFileDrop() {
		return jFocusNormalTextAreaFileDrop;
	}

	
	@Override
	public JPanel getjPanelScrollWrapFoundStack() {
		// 
		return jPanelScrollWrapFoundStack;
	}


	@Override
	public JScrollPane getScrollPaneReturnedResults() {
		// 
		return ScrollPaneReturnedResults;
	}


	@Override
	public JPanel getjPanelFoundScrollerHost() {
		// 
		return jPanelFoundScrollerHost;
	}

	private Component getJPanelReqHistoryTop() {
		if(jPanelReqHistoryTop == null) {
			jPanelReqHistoryTop = new JPanel();
			jPanelReqHistoryTop.setMaximumSize(new java.awt.Dimension(32767, 10));
		}
	return jPanelReqHistoryTop;	
	}

	@Override
	public JPanel getJPanelMainStatusBar() {
		
		
		if(jPanelMainStatusBar == null) {
			jPanelMainStatusBar = new JPanel();
			
			BorderLayout SBLayout = new BorderLayout();
			jPanelMainStatusBar.setLayout(SBLayout);
			
			jPanelMainStatusBar.setPreferredSize(new java.awt.Dimension(350, 31));
			jPanelMainStatusBar.setMaximumSize(new java.awt.Dimension(32767, 29));
			jPanelMainStatusBar.setMinimumSize(new java.awt.Dimension(100, 29));
			jPanelMainStatusBar.setSize( 350, 31);
			
			// jPanelMainStatusBar.setLayout(null);
		}
		return jPanelMainStatusBar;
	}

	
	
	
	public JPanel getjPanelHistoryTree() {
		return jPanelHistoryTree;
	}


	public JTabbedPane getjTabbedPaneFocus() {
		return jTabbedPaneFocus;
	}


	@Override
	public Color getMappedColor(JComponent component ) {
		
		return getMappedColor(component, -1) ;
	}

	@Override
	public Color getMappedColor(JComponent component, float transparency) {
		Color color = new Color(0.6f,0.6f,0.6f,1f);
		float t = transparency;
		
		if (mappedColors.containsKey(component)){
			_BaseColor _bc = mappedColors.get(component);
			if (t<0){
				t = _bc.getTransparency() ;
			}
			color = new Color( _bc.colorChannels[0],_bc.colorChannels[1],_bc.colorChannels[2], t) ;	
		}
		 
		return color;
	}


	@Override
	public void setMappedColor(JComponent component, float[] colorChannels) {
		// 
		float[] c = colorChannels;

		if (c.length==3){
			c = new float[4];
			c[0] = colorChannels[0];c[1] = colorChannels[1];
			c[2] = colorChannels[2]; c[3]=1f;
		}

		if (c.length==1){
			c = new float[4];
			float cv = colorChannels[0]; 
			c[0] = cv;c[1] = cv;c[2] = cv;c[3]=1f;
		}
		if (c.length>=4){
			component.setBackground( new Color(c[0],c[1],c[2],c[3]) );
		}else{
			component.setBackground( new Color(c[0],c[1],c[2],c[3]) );
		}
			
			
		
		mappedColors.put(component, new _BaseColor(colorChannels));
	}


	public void relocateFoundItemsPanel(int direction) {
		// 
		JTabbedPane tabbedPane ;
		JPanel panelFound;

		isSimpleWindow = false;
		tabbedPane = getTabbedPaneMain();
		panelFound = getPanelFound();
		
		if (direction < 0) {
			
			isSimpleWindow = true; 
			
			tabbedPane.setVisible(false);
		
			// getWindowGui().getToolBar().setVisible(false);
			getContentPanel().setVisible(false);

			jPanelFoundTab.remove(panelFound);

			getTopPanel().add(panelFound,BorderLayout.CENTER);
			getTopPanel().add(getJPanelMainStatusBar(), BorderLayout.SOUTH);
			
			int w = getTopPanel().getWidth() ;
			int h = getTopPanel().getHeight() ;
			Dimension md = new Dimension(w-60,h);
			getTopPanel().setSize( md );
			getTopPanel().setPreferredSize( md );

			windowAppearance.prepareSimpleView(1);
			windowAppearance.prepareSimpleView(2);
			
			// TODO: windowGui.getJPanelMainStatusBar() we also have to relocate it!!
		}
		if (direction > 0) {
			
			
			int w = getTopPanel().getWidth() ;
			int h = getTopPanel().getHeight() ;
			Dimension md = new Dimension(w+60,h);
			getTopPanel().setSize( md );
			getTopPanel().setPreferredSize( md );
			
			getContentPanel().setVisible(true);
			tabbedPane.setVisible(true);
			
			getTopPanel().remove(panelFound);

			parentBasePanel.remove( contentPanel ); 
		    BorderLayout parentBasePanelBorderLayout = new BorderLayout();
		    parentBasePanel.setLayout(parentBasePanelBorderLayout);

		    parentBasePanel.add( contentPanel,BorderLayout.CENTER );
		    
			jPanelFoundTab.add(panelFound,BorderLayout.CENTER);
			
			contentPanel.add(getJPanelMainStatusBar(), BorderLayout.SOUTH);
			
			jPanelFoundTab.setVisible(true);
			// setting visibility by modifying transparency
			windowAppearance.prepareSimpleView(3);
			
			isSimpleWindow = false;
			// windowGui.getJPanelMainStatusBar() we also have to relocate it!!
		}
		

	}


	public boolean isSimpleWindow() {
		return isSimpleWindow;
	}


	public void setSimpleWindow(boolean isSimpleWindow) {
		this.isSimpleWindow = isSimpleWindow;
	}


	@Override
	public void setSettingsProvider(ITexxWindowGuiFormSettings formSettings) {
		// 
		guiFormSettings = formSettings;
	}


	@Override
	public Component getjPanelPGraphics() {
		// 
		return jPanelPGraphics;
	}


	@Override
	public JButton getNewButton() {
		// 
		return newButton;
	}


	@Override
	public JButton getOpenButton() {
		return openButton;
	}


	@Override
	public JButton getSaveButton() {
		// 
		return saveButton;
	}


	@Override
	public ITexxWindowGuiFormSettings getGuiFormSettings() {
		// 
		return guiFormSettings;
	}


	@Override
	public JPanel getPanelMetaSearchBrowser() {
		return PanelMetaSearchBrowser;
	}


	public JTextField getTextFieldDedicatedSearch() {
		return TextFieldDedicatedSearch;
	}


	@Override
	public JPanel getjPanelWebMeta() {
		return jPanelWebMeta;
	}


	@Override
	public void showResultPanelPopup(int panelIndex) {
		// 
		out.print(2, "Popup requested for results panel panelIndex");
	}

	public void configureMainStatusBar(MainStatusBar mainStatusBar) {
		// 
		mainStatusBar.createButtons(1);
		this.mainStatusBar = mainStatusBar;
	}

	public void configureResultPanelPopupMenu() {
		// 
		resultPanelPopupMenu  = new ResultPanelPopupMenu(windowGui) ;
		// this.resultPanelPopupMenu = panelPopupMenu;
		resultPanelPopupMenu.create(); 
		// it will be attached by each panel itself,
		// hence it has to exist before any of the panels exist
	}

	@Override
	public ResultPanelPopupMenu getResultPanelPopupMenu() {
		return resultPanelPopupMenu;
	}


	@Override
	public MainStatusBar getMainStatusBar() {
		return mainStatusBar;
	}

	@Override
	public void setLastClickedPhysicalPanel(int panelIndex) {
		lastClickedPhysicalResultsPanel = panelIndex;
	}

	@Override
	public int getLastClickedPhysicalPanel() {
		return lastClickedPhysicalResultsPanel ;
	}

	public int getLastClickedPhysicalResultsPanel() {
		return lastClickedPhysicalResultsPanel;
	}


	public void setLastClickedPhysicalResultsPanel(
			int lastClickedPhysicalResultsPanel) {
		this.lastClickedPhysicalResultsPanel = lastClickedPhysicalResultsPanel;
	}


	public void controlVerticalSize() {
		// TODO Auto-generated method stub
		
	}


	

	

}







class AdvScrolling implements Runnable{
	
	ITexxWindowGui2 windowGui;
	JScrollPane scrollPane;
	private JScrollBar scrollbar;
	boolean isRunning;
	
	Thread asThrd;
	long dT,lastEventTime, currentTime;
	
	public AdvScrolling( ITexxWindowGui2 windowgui,AdjustmentListener adjustmentListener) {
		windowGui = windowgui;
		scrollPane = windowGui.getScrollPaneReturnedResults();
		scrollbar = scrollPane.getVerticalScrollBar();
		scrollbar.setDoubleBuffered(true);
		
		asThrd = new Thread(this,"asThrd") ; 
	}

	protected void verticalScrollBarAdjustmentValueChanged(AdjustmentEvent evt) {
		
		// windowGui.out.print(2, "scroll event : "+ evt);
		dT = System.currentTimeMillis() - lastEventTime ;  
		
		if (dT>1000){
			if (isRunning){
				isRunning=false; 
				windowGui.out.delay(5);		
			}
			int r=1;
			while (r != 0) {
				try {
					asThrd.start();
					r = 0;
				} catch (Exception e) {
					r = -1;
				}
			} // ?->
		}
		lastEventTime = System.currentTimeMillis();
		
	}

	private void repaint(){
		windowGui.getjPanelFoundScrollerHost().repaint();
		windowGui.getjPanelScrollWrapFoundStack().repaint();
	}
	@Override
	public void run() {
		isRunning=true;
		while ((dT<100) && (isRunning)){
			windowGui.out.delay(5);
			// windowGui.out.print(2,"scroll event --- dT = "+dT);
		
		}
		isRunning=false;
		repaint();
		
	}
}


class _BaseColor{
	
	float[] colorChannels = new float[4];
	
	public _BaseColor( float[] colorchannels ){
		colorChannels[3]  =-1f;
		
		colorChannels[0]  = colorchannels[0];
		colorChannels[1]  = colorchannels[1];
		colorChannels[2]  = colorchannels[2];
		if (colorchannels.length>3){
			colorChannels[3]  = colorchannels[3];
		}
	}

	public float getTransparency() {
		float t = 1f;
		
		if ((colorChannels.length>=4) && (colorChannels[3]>=0.0)){
			t = colorChannels[3];
		}
		return t;
	}
}